package com.zb.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.zb.constant.StoreConstant;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.Date;

/**
 * <p>
 * 仓储类型表
 * </p>
 *
 * @author WEN
 * @since 2024-01-06
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="ZjStoreType对象", description="仓储类型表")
public class ZjStoreType implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "主健ID")
    private Long id;

    @ApiModelProperty(value = "商家ID")
    private Long custAccId;

    @ApiModelProperty(value = "类型：1-入库，2-出库")
    private Integer type;

    @ApiModelProperty(value = "类型名称")
    private String name;

    @ApiModelProperty(value = "是默认为工单配件出库类型：0-否，1-是")
    @TableField("is_out_store_order_spare_type")
    private Boolean outStoreOrderSpareType;

    @ApiModelProperty(value = "是默认为工单配件入库类型：0-否，1-是")
    @TableField("is_in_store_order_spare_type")
    private Boolean inStoreOrderSpareType;

    @ApiModelProperty(value = "是否禁用：0-否，1-是")
    @TableField("is_disabled")
    private Boolean disabled;

    @ApiModelProperty(value = "创建时间")
    @TableField(fill = FieldFill.INSERT)
    private Date gmtCreate;

    @ApiModelProperty(value = "更新时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date gmtUpdate;

    public static ZjStoreType inStoreType(Long custAccId, String name, Boolean inStoreOrderSpareType) {
        ZjStoreType type = new ZjStoreType();
        type.setId(IdWorker.getId());
        type.setCustAccId(custAccId);
        type.setType(StoreConstant.STORE_OUT_IN_TYPE_1);
        type.setName(name);
        type.setOutStoreOrderSpareType(false);
        type.setInStoreOrderSpareType(inStoreOrderSpareType);
        type.setDisabled(false);
        return type;
    }

    public static ZjStoreType outStoreType(Long custAccId, String name, Boolean outStoreOrderSpareType) {
        ZjStoreType type = new ZjStoreType();
        type.setId(IdWorker.getId());
        type.setCustAccId(custAccId);
        type.setType(StoreConstant.STORE_OUT_IN_TYPE_2);
        type.setName(name);
        type.setOutStoreOrderSpareType(outStoreOrderSpareType);
        type.setInStoreOrderSpareType(false);
        type.setDisabled(false);
        return type;
    }


}
